package leerxml;

import java.util.List;

public class TemplateStructure {

	
	private String title;
	private List<TemplateStructure> subItems;	
	
	
	public TemplateStructure(){
		subItems = null;
	}
	
	public void setTitle(String t){
		this.title = t;
	}
	
	public String getTitle(){
		return this.title;
	}
	
	public void setStructure(List<TemplateStructure> list){
		this.subItems = list;
	}
	
	public List<TemplateStructure> getStrcture(){
		return this.subItems;
	}
	
	public void addSubSection(List<TemplateStructure> list){
		subItems = list;
	}
	
	public String print(int nivel){
		String text = this.title;
		
		if(this.subItems != null){
			nivel++;
			text = text + "\n";
			for (TemplateStructure struct : subItems) {
				for(int i=0; i < nivel;i++){ 
					text = text + "   ";
				}
				 text = text + struct.print(nivel) + "\n";
			}
		}
		return text;
	}
	
	public boolean isItem(){
		return subItems ==null;
		
	}
}
